<h:panelGroup xmlns:h='http://java.sun.com/jsf/html'
              xmlns:p='http://primefaces.org/ui'
              xmlns:z='http://savanti.com.bo/ui'
              xmlns:s='http://savanti.com.bo/ui-simple'
              xmlns:x='http://java.sun.com/jsf/composite/ui/component'
              xmlns:e='http://java.sun.com/jsf/composite/ui/component-entity' styleClass='ITVenta' id='ITVenta'><p:growl id='growl'/>

<z:focus focus='#{ITVenta.focus}'/>

<z:beanMenubar bean='#{ITVenta}' title='VENTA #{ITVenta.entity.id}' dateIni='#{ITVenta.dateIni}' dateEnd='#{ITVenta.dateEnd}' print='report'/>


<p:overlayPanel for='btnPrint'>

  <p:commandButton icon='ui-icon-trash' title='Limpiar Impresora' update='@(.ITVenta)' actionListener='#{ITVenta.uiCleanPrint}' style='border:none;float:right'/>

  <h:panelGrid id='report'>

  <h:panelGrid  style='text-align:center;white-space:pre;font-size:12px;font-family:Consolas' rendered='#{not ITVenta.nota and ITVenta.report != null}'>

  <h:outputText value='#{ITVenta.report}'/>

  <p:barcode value='#{ITVenta.barcode}' type='qr' width='200' height='200'/>

  <h:outputText value='ESTA FACTURA CONTRIBUYE AL DESARROLLO'/>

  <h:outputText value='DEL PAIS. EL USO ILICITO DE ESTA SERA'/>

  <h:outputText value='SANCIONADO DE ACUERDO A LEY'/>

  </h:panelGrid>

</h:panelGrid></p:overlayPanel>


<h:panelGrid columns='1' width='100%' rendered='#{ITVenta.form}'>

<h:panelGrid id='bean' columns='2' styleClass='bean align-top'>

  <x:beanPanel id='hd' bean='#{ITVenta}' title='Cabecera' cellpadding='0' style='min-width: 355px; max-width: 355px'>

  <h:panelGrid columns='1' cellpadding='4'>

  <x:fieldD b='#{bean}' t='Fecha'   wT='52px' w='124px' v='#{bean.entity.fecha}' x='t'/>

  <x:fieldS b='#{bean}' t='Cliente' wT='52px' w='124px' v='#{bean.entity.cliente}' x='#{x}' xL='#{x.persona.nombre}' s='#{ITVenta.selectCliente}'/>

  </h:panelGrid>

  <h:panelGrid columns='1' cellpadding='4'>

  <x:fieldC b='#{bean}' t='Nota'     wT='45px'           v='#{bean.nota}'/>

  <x:fieldN b='#{bean}' t='Total'    wT='45px' w='60px'  v='#{bean.entity.total}' style='background:#ffcc25;font-size:115%'/>

  </h:panelGrid>

  <h:panelGrid columns='1' cellpadding='5' rendered='#{ITVenta.nota}'/>

  <h:panelGrid columns='1' cellpadding='5' rendered='#{not ITVenta.nota}'>

  <x:fieldA b='#{bean}' t='NIT / CI' wT='52px' w='98px'  v='#{bean.nit}' l='buscarNIT' id='nitId'/>

  <x:fieldI b='#{bean}' t='Nombre'   wT='52px' w='120px' v='#{bean.razon}' onkeydown='tab()' id='nombreId'/>

  </h:panelGrid>

  <h:panelGrid columns='1' cellpadding='5' rendered='#{not ITVenta.credito}'>

  <x:fieldN b='#{bean}' t='Vuelto'   wT='45px' w='60px'  v='#{bean.entity.vuelto}' style='background:#ffef1e;font-size:115%'/>

  <x:fieldA b='#{bean}' t='Pagado'   wT='45px' w='50px'  v='#{bean.entity.pagado}' l='calVuelto' u=':#{formId}:bean' onclick="fc('btnSave')"/>

  </h:panelGrid>

  </x:beanPanel>


  <x:beanPanel id='ps' bean='#{ITVenta}' title='Posicion' cellpadding='6' style='min-width: 500px' rendered='#{ITVenta.entity.cliente.id!=null}'>

  <h:panelGrid columns='1' cellpadding='8' style='margin-right: 2px'>

  <x:fieldAL t='Almacen' v='#{bean.almacen.nombre}' s='#{bean.detalle.stock}'/>

  <x:fieldM b='#{bean}' t='Producto' v='#{bean.detalle.material}' x='#{x}' id='materialId'/>

  <x:fieldA b='#{bean}' t='Cantidad' v='#{bean.detalle.cantidad}' w='50px' l='detailAdd' id='cantidadId'/>

  </h:panelGrid>

  <x:materialImage c='#{bean.detalle.material.id}' t='Bs. ' v='#{bean.detalle.precio}' r='2'/>

  </x:beanPanel>

</h:panelGrid>


<x:materialTable bean='#{ITVenta}' ls='#{ITVenta.entity.lsVentaDetalle}'>

<s:columnT t='Codigo'    v='#{x.material.codigo}' w='55px'/>

<s:columnT t='Nombre'    v='#{x.material.nombre}'/>

<s:columnN t='Stock'     v='#{x.stock}'           w='75px'/>

<s:columnN t='Cantidad'  v='#{x.cantidad}'        w='75px'/>

<s:columnN t='Precio'    v='#{x.precio}'          w='75px'/>

<s:columnN t='Importe'   v='#{x.importe}'         w='75px'/>

<s:columnN t='Descuento' v='#{x.descuento}'       w='75px'/>

<s:columnN t='Total'     v='#{x.total}'           w='75px'/>

</x:materialTable>


<h:panelGroup rendered='#{ITVenta.nota and ITVenta.report != null}'>

<div style='text-align: center'>

  <OBJECT classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' width='350' height='16'

          codebase= 'http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4'>

  <param name='CODE' value='eva.savant.core.printer.PrinterApplet'/>

  <param name='ARCHIVE' value='../resources/applet/printerApplet.jar'/>

  <param name='TxtPrint' value='#{ITVenta.report}'/>

  <COMMENT>

  <embed TxtPrint='#{ITVenta.report}' type='application/x-java-applet' width='350' height='16'

         archive='../resources/applet/printerApplet.jar' code='eva.savant.core.printer.PrinterApplet.class'>

  <noembed>No se ecuentra instalado Java Standard Edition, es requerido ...!!</noembed>

  </embed>

  </COMMENT>

  </OBJECT>


  <p:commandButton icon='ui-icon-trash' title='Limpiar Impresora' update='@(.ITVenta)' actionListener='#{ITVenta.uiCleanPrint}' style='border:none'/>

</div>

</h:panelGroup>

</h:panelGrid>


<e:dataTable bean='#{ITVenta}'>

<z:columnT w='60px' t='Pedido'  v='#{x.id}'/>

<z:columnD w='70px' t='Fecha'   v='#{x.fecha}'/>

<z:columnD w='70px' t='Entrega' v='#{x.entrega}'/>

<z:columnT t='Cliente' v='#{x.cliente.persona.nombre}'/>

<z:columnN w='70px' t='Importe' v='#{x.total}'/>

</e:dataTable>

</h:panelGroup>